#ifndef ONEMANGA_H
#define ONEMANGA_H

#include <QObject>
#include <QHttp>
#include <QUrl>
#include <QHash>

class OneManga : public QObject
{
    Q_OBJECT

public:
    OneManga();
    void getImage(QString s);
    void getMangas();
    QString getCurrentAddress();

private:
    QHttp m_http;
    int m_progressTotalStep;
    int m_currentProgress;
    int performProgressStep();
    QString m_currentAddress;
    QMap<QString, QString>  parseWebComboBox(const QString & boxName, const QString & htmlPage);

private slots:
    void on_data_received(int id, bool error);
    void on_img_received(int id, bool error);
    void on_index_received(int id, bool error);

signals:
    void imageReady(QByteArray b);
    void nextReady(QString next);
    void previousReady(QString prev);
    void mangasReady(QMap<QString, QString> mangas);
    void progressStep(int value);
};

#endif // ONEMANGA_H
